package com.youyi.yycutsdklibrary.SDK;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;

public class YYCutSDK {
    public static OnYYCutListener mOnYYCutListener;
    private static final YYCutSDK ourInstance = new YYCutSDK();
    private Context mContext;

    public enum CutShape {
        Oval,
        Rect,
        Squar
    }

    public interface OnYYCutListener {
        void result(boolean z, String str, Bitmap bitmap);
    }

    public static YYCutSDK getInstance(Context context) {
        YYCutSDK yYCutSDK = ourInstance;
        yYCutSDK.initContext(context);
        return yYCutSDK;
    }

    private void initContext(Context context) {
        this.mContext = context;
    }

    private YYCutSDK() {
    }

    public void cut(String str, boolean z, CutShape cutShape, OnYYCutListener onYYCutListener) {
        mOnYYCutListener = onYYCutListener;
        Intent intent = new Intent(this.mContext, YYCutSDKActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.putExtra("imgPath", str);
        intent.putExtra("isShowLine", z);
        int i = cutShape.ordinal();
        if (i == 1) {
            intent.putExtra("isOval", true);
            intent.putExtra("isSquare", true);
        } else if (i == 2) {
            intent.putExtra("isOval", false);
            intent.putExtra("isSquare", false);
        } else if (i == 3) {
            intent.putExtra("isOval", false);
            intent.putExtra("isSquare", true);
        }
        this.mContext.startActivity(intent);
    }

    public void cutBySize(String str, boolean z, int i, int i2, OnYYCutListener onYYCutListener) {
        mOnYYCutListener = onYYCutListener;
        Intent intent = new Intent(this.mContext, YYCutSDKActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.putExtra("imgPath", str);
        intent.putExtra("isShowLine", z);
        intent.putExtra("isOval", false);
        intent.putExtra("width", i);
        intent.putExtra("height", i2);
        this.mContext.startActivity(intent);
    }
}
